<%@page language="java" contentType="text/html; charset=utf-8"%>
<%@include file="/tagDeclare.jsp"%>
<%@include file="/headDeclare.jsp"%>
<html>
<head>
<title>新增权限信息</title>
	<style type="text/css">
		tr{height: 30px;}
		td{margin: 5px;padding: 5px;}
	</style>
<script type="text/javascript">
	var dialog = frameElement.dialog; //调用页面的dialog对象(ligerui对象)
	$(document).ready(function() {
		$('#rightName').focus();
		$.ajaxSetup({
			cache : false,
			async : false
		});
		//异步提交表单
		var options = {
			dataType : 'json',
			beforeSubmit : checkSubmit,
			success : process
		};
		$("#rightForm").submit(function() {
			$(this).ajaxSubmit(options);
			return false;
		});
	});

	function process(responseJson) {
		if (responseJson.code == 0) {
			$.ligerDialog.error(responseJson.message);
			return;
		} else {
			window.parent.parent.frames["righttree"].location.reload();
			window.parent.pagerForm.submit();
			dialog.close();
		}
	}

	function checkSubmit() {
		var rightName = $("#rightName").val();
		if (isEmpty(rightName)) {
			$.ligerDialog.alert("权限名称不能为空");
			$("#rightName").focus();
			return false;
		}
		var rightMark = $("#rightMark").val();
		if (isEmpty(rightMark)) {
			$.ligerDialog.alert("权限标识不能为空");
			$("#rightMark").focus();
			return false;
		}
		return true;
	}
</script>
</head>
<body>
	<div>
		<form id="rightForm" method="post" action="right/insert.do">
			<input id="pid" name="upRightId" type="hidden" value="${pid}" />
			<table>
				<tr>
					<td><label for="town">权限名称：</label></td>
					<td><input type="text" name="rightName" id="rightName" class="ldText" /></td>
				</tr>
				<tr>
					<td><label for="town">权限标识：</label></td>
					<td><input type="text" name="rightMark" id="rightMark" class="ldText" /></td>
				</tr>
				<tr>
					<td><label for="town">权限URL：</label></td>
					<td><input type="text" name="rightUrl" id="rightUrl" class="ldText" /></td>
				</tr>
			</table>
		</form>
	</div>
</body>
</html>